package com.winit.deploy.bean;

import org.springframework.util.StringUtils;

import java.util.List;

/**
 * Created by wangjian on 16/8/16.
 */
public class DeployTask implements Comparable<DeployTask> {

    private String id;
    private String group;
    private String name;
    private String ip;
    private String type;
    private String dstUser;
    private Integer port;// ssh端口
    private String configPath;// OPS/ops.demo.produce.gzidc.area
    private List<String> status;
    private String statusMsg;

    private String serverPath;//tomcat路径
    //    private String logPath;//日志路径 logs/catalina.out
//    private String projectDir;//工程文件路径 webapps
    private Integer httpPort;//tomcat端口
    //    private String system;//系统类型 下拉框  ubuntu or centos 默认选中centos
    private String javaHome;//jdk路径
    //    private String warTempDir;//终端上临时保存war包的路径,不带文件名
    private String backUpPath;
//    private String backUpDir;//备份文件存放路径 不带文件名

    private String is_resource;
    private Integer jmx_port;
    private Integer agent_port;

    public Integer getHttpPort() {
        return httpPort;
    }

    public void setHttpPort(Integer httpPort) {
        this.httpPort = httpPort;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDstUser() {
        return dstUser;
    }

    public void setDstUser(String dstUser) {
        this.dstUser = dstUser;
    }

    public String getConfigPath() {
        return configPath;
    }

    public void setConfigPath(String configPath) {
        this.configPath = configPath;
    }

    public List<String> getStatus() {
        return status;
    }

    public void setStatus(List<String> status) {
        this.status = status;
    }

    public String getStatusMsg() {
        return statusMsg;
    }

    public void setStatusMsg(String statusMsg) {
        this.statusMsg = statusMsg;
    }

    public String getServerPath() {
        return serverPath;
    }

    public void setServerPath(String serverPath) {
        this.serverPath = serverPath;
    }

    public String getJavaHome() {
        return javaHome;
    }

    public void setJavaHome(String javaHome) {
        this.javaHome = javaHome;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getBackUpPath() {
        return backUpPath;
    }

    public void setBackUpPath(String backUpPath) {
        this.backUpPath = backUpPath;
    }

    @Override
    public int compareTo(DeployTask o) {
        return this.name.compareTo(o.getName());
    }

    public String getIs_resource() {
//        if (StringUtils.isEmpty(is_resource)) {
//            return "0";
//        }
        return is_resource;
    }

    public void setIs_resource(String is_resource) {
//        if (StringUtils.isEmpty(is_resource)) {
//            is_resource = "0";
//        }
        this.is_resource = is_resource;
    }

    public Integer getJmx_port() {
//        if (("tomcat".equals(this.type) || "spring_boot_jar".equals(this.type)) && StringUtils.isEmpty(this.jmx_port)) {
//            return 10001;
//        }
        return jmx_port;
    }

    public void setJmx_port(Integer jmx_port) {
//        if (("tomcat".equals(this.type) || "spring_boot_jar".equals(this.type)) && StringUtils.isEmpty(this.jmx_port)) {
//            jmx_port = 10001;
//        }
        this.jmx_port = jmx_port;
    }

    public Integer getAgent_port() {
//        if ("php".equals(this.type) && StringUtils.isEmpty(this.agent_port)) {
//            return 7777;
//        }
        return agent_port;
    }

    public void setAgent_port(Integer agent_port) {
//        if ("php".equals(this.type) && StringUtils.isEmpty(this.agent_port)) {
//            agent_port = 7777;
//        }
        this.agent_port = agent_port;
    }
}
